import numpy as np
# (3,4)
a = np.array([
    [1,4,2,5],
    [5,6,7,8],
    [9,10,12,13]
])
c = np.array([
    [8,7,255,6],
    [5,255,255,255],
    [3,5,255,255]
])
b = np.zeros((3,4))
clo, row = a.shape
# 1.循环
print(clo, row)
for i in range(3):
    for j in range(4):
        if(c[i][j]==255):
            b[i][j] = c[i][j]
        else:
            b[i][j] = a[i][j]
print(b)


# 2
index = c == 255
# [[False False  True False]
#  [False  True  True  True]
# [False False  True  True]]
print(index)
a[index] = 255
print(a)

# 3
index = np.where(c == 255)
# (array([0, 1, 1, 1, 2, 2], dtype=int64)
# array([2, 1, 2, 3, 2, 3], dtype=int64))
print(index)
a[index] = 255
print(a)